﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataLogical;
using Biz.Status;

namespace Biz.UserManagement
{
    public class GAUser : Employee, IApplicationActor
    {
        private Application application = null;

        public System.Data.DataTable ListAllTreatApplication()
        {
            return ApplicationTreat.ListAllWithGA();
        }

        public System.Data.DataTable ListAllPresentApplication()
        {
            return ApplicationPresent.ListAllWithGA();
        }

        public GAUser(int _id)
            : base(_id)
        {
            
        }

        public GAUser(int _id, Application _application)
            : base(_id)
        {
            application = _application;
        }

        public void Pay()
        {
            Facade.PaymentSystem p = new Facade.PaymentSystem();
            if (p.Pay(application))
                application.Status = (ApplicationStatus)Factory.Factory.getInstance().CreateProduct(ApplicationStatus.StatusType.Completed.ToString());
            else
                throw new ApplicationException("支付失败");
        }
    }
}
